<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class Business extends Model
{

    protected $table = 'business';

    public $timestamps = false;

    protected $primaryKey = 'business_id';

    protected $fillable = [
        'business_id',
        'business_name',
        'area_id',
        'orderby',
        'is_hot',
        'lat',
        'lng',
        'photo',
        'photo_oss',
    ];

    protected $casts = ['photo'];

    public function getPhotoAttribute($value)
    {
        return \App\Library\HandleFile::handleFilePath($value, $this->photo_oss);
    }

    public function area()
    {
        return $this->hasOne('App\\Models\\Area', 'area_id', 'area_id');
    }
}
